package rhc.taskSchedule.taskSignalCall.impl;

import org.apache.log4j.Logger;

import rhc.taskSchedule.entity.Task;
import rhc.taskSchedule.taskSchedule.task.TaskExecute;
import rhc.taskSchedule.taskSignalCall.CustomCall;

/**传递给客户系统，由客户系统决定何时运行或停止
 * @author lenovo
 *
 */
public class CustomCallImpl implements CustomCall{

	private Logger logger=Logger.getLogger(getClass());
	
	private TaskExecute taskExecute;
	
	public CustomCallImpl(TaskExecute taskExecute) {
		this.taskExecute=taskExecute;
	}

	@Override
	public void run() throws Exception {
		logger.info("custom call run");
		taskExecute.run();
	}

	@Override
	public void stop() throws Exception {
		logger.info("custom call stop");
		taskExecute.stop();
	}

	@Override
	public void pause() throws Exception {
		logger.info("custom call pause");
		taskExecute.pause();
	}

	@Override
	public void regain() throws Exception {
		logger.info("custom call regain");
		taskExecute.regain();
	}

	@Override
	public String getTaskId() throws Exception {
		return taskExecute.getSourceId();
	}

}
